package org.example.demo;

public class MyClassLoader extends ClassLoader{
    @Override
    protected Class<?> findClass(String name) throws ClassNotFoundException {
        System.out.println("MyClassLoader: findClass: name==>" + name);
        if("demo.HelloWorldAsm".equals(name)){
            byte [] bytes = HelloWordAsm.genHelloWorldClass();
            Class<?> aClass = defineClass(name, bytes, 0, bytes.length);
            return aClass;
        }
        return super.findClass(name);
    }
}
